<?php 
	include_once './Facebook/lib/config.php';
?>
<html>
<head>

</head>
<body>
	<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
	<script src="./Facebook/javascript/fbconnect.js" type="text/javascript"></script>
	<script type="text/javascript">
 		FB.init("<?php echo $api_key?>", "./Facebook/xd_receiver.php");
	</script>
	
<?php

	
	$user = User::fbc_getLoggedIn();
	
	if($user){
	
	 $fb_active_session = $user->fbc_is_session_active();
	
	}else{
	
	 $fb_active_session = FALSE;
	
	}
	
	if (!$user){
	
	    if (is_fbconnect_enabled()) {
	    	$html = render_fbconnect_button('medium');
	    }else{
	        $html = 'fbconnect disabled';
	    }
	    echo $html;
	
	}else{
	
	    if ($user->fbc_is_facebook_user()){
	
	        echo $user->fbc_getProfilePic_xfbml(true);
	        echo utf8_decode("Bienvenido " . $user->fbc_name.'<br />');
	        //echo '<a href="" onClick="FB.Connect.logout(function() { refresh_page(); })">Logout</a>';
	        echo '<a href="" onClick="FB.Connect.logout()">Logout</a>'; //validar que la pagina no refresque para no perder el logout

	    }
	}

?>
	
	
</body>
</html>
